﻿Ext.define('Examples.autoorder.order.metadata.Metadata', {
    extend: 'Happy.metadata.Metadata',
    singleton: true,
    requires: ['Examples.autoorder.orderitem.metadata.Metadata'],

    data: {
        namespace: 'Examples.autoorder',
        name: 'Order',
        plural: 'Orders',
        proxy: {
            actionMethods: {
                create: 'GET',
                read: 'GET',
                update: 'GET',
                destroy: 'GET'
            },
            api: {
                create: 'app/order/server/create.txt',
                read: 'app/order/server/read.txt',
                load: 'app/order/server/load.txt',
                update: 'app/order/server/update.txt',
                destroy: 'app/order/server/destroy.txt'
            }
        },
        properties: {
            Id: {
                name: 'Id',
                dataType: "Guid"
            },
            Name: {
                name: 'Customer',
                dataType: "String"
            }
        }
    },

    constructor: function () {
        var me = this;

        me.data.relation = {
            hasMany: [
                {
                    metadata: window.Examples.autoorder.orderitem.metadata.Metadata,
                    foreignKey: 'OrderId'
                }
            ]
        };

        me.callParent(arguments);
    }
});